package com.xxx.service.impl;

import com.xxx.service.TPTestingService;
import org.apache.dubbo.config.annotation.Service;

import java.util.Random;

/**
 * Created by louisyuu on 2020/5/5 下午5:13
 */

/**
 * 注意这里的Service是org.apache.dubbo.config.annotation.Service;
 */
@Service
public class TPTestingServiceImpl implements TPTestingService {


    @Override
    public String testingOne() {

        try {
            Thread.sleep(getRandomSleepTimeMillis());
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "I'm testing one service";
    }

    @Override
    public String testingTwo() {
        try {
            Thread.sleep(getRandomSleepTimeMillis());
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "I'm testing two service";
    }

    @Override
    public String testingThree() {
        try {
            Thread.sleep(getRandomSleepTimeMillis());
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "I'm testing three service";
    }


    private long getRandomSleepTimeMillis() {

        Random random = new Random();
        int i = random.nextInt(100);
        return (long) i;

    }


}
